<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1. let声明的变量有`严格的局部作用域`；var声明的变量会越域。
        {
            var a = 1;
            let b = 2;
        }
        console.log(a);
        console.log(b);

        // 2. let`只能声明一次`；var可以声明多次。
        var m = 1;
        var m = 2;
        console.log(m);
        let n = 1;
        let n = 2;
        console.log(n);

        // 3.let不存在变量提升
        console.log(x);
        var x = 10;
        vonsile.log(y);
        var y = 20;

    </script>
</body>

</html>